package org.lanqiao.tjut.testdemo;

import org.lanqiao.tjut.pizza.Pizza;
import org.lanqiao.tjut.pizzastore.ChicagoPizzaStore;
import org.lanqiao.tjut.pizzastore.NYPizzaStore;
import org.lanqiao.tjut.pizzastore.PizzaStore;

//抽象工厂模式：相比工厂模式，多出了一层接口。
//1.所有披萨配料的接口。
//2.继承不同的配料接口产生了不同种类的披萨。
//3.配料总工厂集合所有配料接口。
//4.芝加哥配料厂，纽约配料厂继承配料总厂。
//5.芝加哥披萨店中创建了芝加哥配料厂实例，纽约配料厂也是。
//6.芝加哥披萨店，纽约披萨店，继承披萨总店。和工厂模式一样。

public class PizzaTestDrive {

	public static void main(String[] args) {
		PizzaStore nyStore = new NYPizzaStore();
		PizzaStore chicagoStore = new ChicagoPizzaStore();

		Pizza pizza = nyStore.orderPizza("cheese");
		System.out.println("Ethan ordered a " + pizza + "\n");

		pizza = chicagoStore.orderPizza("cheese");
		System.out.println("Joel ordered a " + pizza + "\n");

		pizza = nyStore.orderPizza("clam");
		System.out.println("Ethan ordered a " + pizza + "\n");

		pizza = chicagoStore.orderPizza("clam");
		System.out.println("Joel ordered a " + pizza + "\n");

		pizza = nyStore.orderPizza("pepperoni");
		System.out.println("Ethan ordered a " + pizza + "\n");

		pizza = chicagoStore.orderPizza("pepperoni");
		System.out.println("Joel ordered a " + pizza + "\n");

		pizza = nyStore.orderPizza("veggie");
		System.out.println("Ethan ordered a " + pizza + "\n");

		pizza = chicagoStore.orderPizza("veggie");
		System.out.println("Joel ordered a " + pizza + "\n");
	}
}
